<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\Relations\HasMany;
use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\DbConnection\Model\Model;
/**
 * @property int $id 
 * @property int $agent_id
 * @property int $num 
 * @property string $remark 
 * @property int $create_time 
 */
class AgentMoney extends Model
{
    public $dateFormat = 'U';

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'agent_money';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $guarded = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'agent_id' => 'integer', 'created_at' => 'int'];


    /**
     * 关联购买用户
     *
     * @return HasOne
     */
    public function lower() :HasOne
    {
        return $this->HasOne(User::class,  'id','lower_id');
    }
}